<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="130px"
    >
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
        <el-button
          :icon="!isOpen ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
          size="mini"
          @click="shouqi"
          >展开/收起</el-button
        >
      </el-form-item>
      <div v-if="isOpen">
        <el-form-item label="日期" prop="dataDate">
          <el-date-picker
            clearable
            v-model="queryParams.dataDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="店铺id" prop="shopId">
          <el-input
            v-model="queryParams.shopId"
            placeholder="请输入店铺id"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="渠道" prop="channel">
          <el-input
            v-model="queryParams.channel"
            placeholder="请输入渠道"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="品牌" prop="brand">
          <el-input
            v-model="queryParams.brand"
            placeholder="请输入品牌"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="场景ID" prop="sceneId">
          <el-input
            v-model="queryParams.sceneId"
            placeholder="请输入场景ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="场景名字" prop="sceneName">
          <el-input
            v-model="queryParams.sceneName"
            placeholder="请输入场景名字"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="计划ID" prop="planId">
          <el-input
            v-model="queryParams.planId"
            placeholder="请输入计划ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="计划名字" prop="planName">
          <el-input
            v-model="queryParams.planName"
            placeholder="请输入计划名字"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="单元ID" prop="unitId">
          <el-input
            v-model="queryParams.unitId"
            placeholder="请输入单元ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="单元名字" prop="unitName">
          <el-input
            v-model="queryParams.unitName"
            placeholder="请输入单元名字"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="宝贝ID" prop="productId">
          <el-input
            v-model="queryParams.productId"
            placeholder="请输入宝贝ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="宝贝名字" prop="productName">
          <el-input
            v-model="queryParams.productName"
            placeholder="请输入宝贝名字"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="词ID/词包ID" prop="wordId">
          <el-input
            v-model="queryParams.wordId"
            placeholder="请输入词ID/词包ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="词名字/词包名字" prop="wordName">
          <el-input
            v-model="queryParams.wordName"
            placeholder="请输入词名字/词包名字"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="展现量" prop="impressions">
          <el-input
            v-model="queryParams.impressions"
            placeholder="请输入展现量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="点击量" prop="clicks">
          <el-input
            v-model="queryParams.clicks"
            placeholder="请输入点击量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="花费" prop="cost">
          <el-input
            v-model="queryParams.cost"
            placeholder="请输入花费"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="点击率" prop="clickRate">
          <el-input
            v-model="queryParams.clickRate"
            placeholder="请输入点击率"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="平均点击花费" prop="avgClickCost">
          <el-input
            v-model="queryParams.avgClickCost"
            placeholder="请输入平均点击花费"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="千次展现花费" prop="qps">
          <el-input
            v-model="queryParams.qps"
            placeholder="请输入千次展现花费"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总预售成交金额" prop="totalPresellFinishAmount">
          <el-input
            v-model="queryParams.totalPresellFinishAmount"
            placeholder="请输入总预售成交金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总预售成交笔数" prop="totalPresellFinishNumber">
          <el-input
            v-model="queryParams.totalPresellFinishNumber"
            placeholder="请输入总预售成交笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="直接预售成交金额" prop="directPresellFinishAmount">
          <el-input
            v-model="queryParams.directPresellFinishAmount"
            placeholder="请输入直接预售成交金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="直接预售成交笔数" prop="directPresellFinishNumber">
          <el-input
            v-model="queryParams.directPresellFinishNumber"
            placeholder="请输入直接预售成交笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="间接预售成交金额"
          prop="indirectPresellFinishAmount"
        >
          <el-input
            v-model="queryParams.indirectPresellFinishAmount"
            placeholder="请输入间接预售成交金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="间接预售成交笔数"
          prop="indirectPresellFinishNumber"
        >
          <el-input
            v-model="queryParams.indirectPresellFinishNumber"
            placeholder="请输入间接预售成交笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="直接成交金额" prop="directFinishAmount">
          <el-input
            v-model="queryParams.directFinishAmount"
            placeholder="请输入直接成交金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="间接成交金额" prop="indirectFinishAmount">
          <el-input
            v-model="queryParams.indirectFinishAmount"
            placeholder="请输入间接成交金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总成交金额" prop="totalFinishAmount">
          <el-input
            v-model="queryParams.totalFinishAmount"
            placeholder="请输入总成交金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总成交笔数" prop="totalFinishNumber">
          <el-input
            v-model="queryParams.totalFinishNumber"
            placeholder="请输入总成交笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="直接成交笔数" prop="directFinishNumber">
          <el-input
            v-model="queryParams.directFinishNumber"
            placeholder="请输入直接成交笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="间接成交笔数" prop="indirectFinishNumber">
          <el-input
            v-model="queryParams.indirectFinishNumber"
            placeholder="请输入间接成交笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="点击转化率" prop="clickConversionRate">
          <el-input
            v-model="queryParams.clickConversionRate"
            placeholder="请输入点击转化率"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="投入产出比" prop="roi">
          <el-input
            v-model="queryParams.roi"
            placeholder="请输入投入产出比"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总成交成本" prop="totalCost">
          <el-input
            v-model="queryParams.totalCost"
            placeholder="请输入总成交成本"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总购物车数" prop="totalCarts">
          <el-input
            v-model="queryParams.totalCarts"
            placeholder="请输入总购物车数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="直接购物车数" prop="directCarts">
          <el-input
            v-model="queryParams.directCarts"
            placeholder="请输入直接购物车数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="间接购物车数" prop="indirectCarts">
          <el-input
            v-model="queryParams.indirectCarts"
            placeholder="请输入间接购物车数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="加购率" prop="addToCartRate">
          <el-input
            v-model="queryParams.addToCartRate"
            placeholder="请输入加购率"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="收藏宝贝数" prop="collectProductCount">
          <el-input
            v-model="queryParams.collectProductCount"
            placeholder="请输入收藏宝贝数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="收藏店铺数" prop="collectStoreCount">
          <el-input
            v-model="queryParams.collectStoreCount"
            placeholder="请输入收藏店铺数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="店铺收藏成本" prop="storeCollectCost">
          <el-input
            v-model="queryParams.storeCollectCost"
            placeholder="请输入店铺收藏成本"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总收藏加购数" prop="totalCollectBuy">
          <el-input
            v-model="queryParams.totalCollectBuy"
            placeholder="请输入总收藏加购数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总收藏加购成本" prop="totalCollectBuyCost">
          <el-input
            v-model="queryParams.totalCollectBuyCost"
            placeholder="请输入总收藏加购成本"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="宝贝收藏加购数" prop="collectBuyProduct">
          <el-input
            v-model="queryParams.collectBuyProduct"
            placeholder="请输入宝贝收藏加购数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="宝贝收藏加购成本" prop="collectBuyProductCost">
          <el-input
            v-model="queryParams.collectBuyProductCost"
            placeholder="请输入宝贝收藏加购成本"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总收藏数" prop="totalCollect">
          <el-input
            v-model="queryParams.totalCollect"
            placeholder="请输入总收藏数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="宝贝收藏成本" prop="collectProductCost">
          <el-input
            v-model="queryParams.collectProductCost"
            placeholder="请输入宝贝收藏成本"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="宝贝收藏率" prop="collectRate">
          <el-input
            v-model="queryParams.collectRate"
            placeholder="请输入宝贝收藏率"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="加购成本" prop="addToCartCost">
          <el-input
            v-model="queryParams.addToCartCost"
            placeholder="请输入加购成本"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="拍下订单笔数" prop="orderPlacementCount">
          <el-input
            v-model="queryParams.orderPlacementCount"
            placeholder="请输入拍下订单笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="拍下订单金额" prop="orderPlacementAmount">
          <el-input
            v-model="queryParams.orderPlacementAmount"
            placeholder="请输入拍下订单金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="直接收藏宝贝数" prop="directCollectProduct">
          <el-input
            v-model="queryParams.directCollectProduct"
            placeholder="请输入直接收藏宝贝数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="间接收藏宝贝数" prop="indirectCollectProduct">
          <el-input
            v-model="queryParams.indirectCollectProduct"
            placeholder="请输入间接收藏宝贝数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="优惠券领取量" prop="couponGetNumber">
          <el-input
            v-model="queryParams.couponGetNumber"
            placeholder="请输入优惠券领取量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="购物金充值笔数" prop="gwjRechargeCount">
          <el-input
            v-model="queryParams.gwjRechargeCount"
            placeholder="请输入购物金充值笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="购物金充值金额" prop="gwjRechargeAmount">
          <el-input
            v-model="queryParams.gwjRechargeAmount"
            placeholder="请输入购物金充值金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="旺旺咨询量" prop="wwConsultationCount">
          <el-input
            v-model="queryParams.wwConsultationCount"
            placeholder="请输入旺旺咨询量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="引导访问量" prop="guidedVisitNumber">
          <el-input
            v-model="queryParams.guidedVisitNumber"
            placeholder="请输入引导访问量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="引导访问人数" prop="guidedVisitPeo">
          <el-input
            v-model="queryParams.guidedVisitPeo"
            placeholder="请输入引导访问人数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="引导访问潜客数" prop="guidedPotentialVisit">
          <el-input
            v-model="queryParams.guidedPotentialVisit"
            placeholder="请输入引导访问潜客数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="引导访问潜客占比"
          prop="guidedPotentialVisitsRatio"
        >
          <el-input
            v-model="queryParams.guidedPotentialVisitsRatio"
            placeholder="请输入引导访问潜客占比"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="引导访问率" prop="guidedVisitsRate">
          <el-input
            v-model="queryParams.guidedVisitsRate"
            placeholder="请输入引导访问率"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="深度访问量" prop="depthOfVisit">
          <el-input
            v-model="queryParams.depthOfVisit"
            placeholder="请输入深度访问量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="平均访问页面数" prop="avgPageViews">
          <el-input
            v-model="queryParams.avgPageViews"
            placeholder="请输入平均访问页面数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="成交新客数" prop="conversionRateNewCustomers">
          <el-input
            v-model="queryParams.conversionRateNewCustomers"
            placeholder="请输入成交新客数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="成交新客占比"
          prop="conversionRateNewCustomersRatio"
        >
          <el-input
            v-model="queryParams.conversionRateNewCustomersRatio"
            placeholder="请输入成交新客占比"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="会员首购人数" prop="vipFirstBuyPeo">
          <el-input
            v-model="queryParams.vipFirstBuyPeo"
            placeholder="请输入会员首购人数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="会员成交金额" prop="vipFinishAmount">
          <el-input
            v-model="queryParams.vipFinishAmount"
            placeholder="请输入会员成交金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="会员成交笔数" prop="vipFinishNumber">
          <el-input
            v-model="queryParams.vipFinishNumber"
            placeholder="请输入会员成交笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="成交人数" prop="vipFinishPeoNum">
          <el-input
            v-model="queryParams.vipFinishPeoNum"
            placeholder="请输入成交人数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="人均成交笔数" prop="avgFinishNumber">
          <el-input
            v-model="queryParams.avgFinishNumber"
            placeholder="请输入人均成交笔数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="人均成交金额" prop="avgFinishAmount">
          <el-input
            v-model="queryParams.avgFinishAmount"
            placeholder="请输入人均成交金额"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="入会率" prop="membershipJoinRate">
          <el-input
            v-model="queryParams.membershipJoinRate"
            placeholder="请输入入会率"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="入会量" prop="membershipJoinCount">
          <el-input
            v-model="queryParams.membershipJoinCount"
            placeholder="请输入入会量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="平均展现排名" prop="avgRanking">
          <el-input
            v-model="queryParams.avgRanking"
            placeholder="请输入平均展现排名"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="月" prop="dataMonth">
          <el-input
            v-model="queryParams.dataMonth"
            placeholder="请输入月"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="年" prop="dataYear">
          <el-input
            v-model="queryParams.dataYear"
            placeholder="请输入年"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="周" prop="dataWeek">
          <el-input
            v-model="queryParams.dataWeek"
            placeholder="请输入周"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </div>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <!-- <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['marketing:BiPromotionKeywordDwd:add']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['marketing:BiPromotionKeywordDwd:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['marketing:BiPromotionKeywordDwd:remove']"
          >删除</el-button
        >
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['marketing:BiPromotionKeywordDwd:export']"
          >导出</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button size="mini" plain icon="el-icon-upload" @click="daoru"
          >导入</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="BiPromotionKeywordDwdList"
      @selection-change="handleSelectionChange"
      @row-dblclick="t"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="推广关键词数据ID" align="center" prop="id" />
      <el-table-column label="日期" align="center" prop="dataDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dataDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="120"
        label="店铺id"
        align="center"
        prop="shopId"
      />
      <el-table-column label="渠道" align="center" prop="channel" />
      <el-table-column label="品牌" align="center" prop="brand" />
      <el-table-column label="场景ID" align="center" prop="sceneId" />
      <el-table-column
        width="120"
        label="场景名字"
        align="center"
        prop="sceneName"
      />
      <!-- <el-table-column label="计划ID" align="center" prop="planId" />
      <el-table-column label="计划名字" align="center" prop="planName" />
      <el-table-column label="单元ID" align="center" prop="unitId" />
      <el-table-column label="单元名字" align="center" prop="unitName">
        <template slot-scope="scope">
          <el-popover trigger="hover" placement="bottom" width="300">
            <el-input
              v-model="scope.row.unitName"
              :min-height="192"
              type="textarea"
              :autosize="{ minRows: 2, maxRows: 24 }"
              :style="{ width: '100%' }"
              :disabled="true"
            />
            <div slot="reference">
              <span class="textname">{{ scope.row.unitName }} </span>
            </div>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column label="宝贝ID" align="center" prop="productId" />
      <el-table-column label="宝贝名字" align="center" prop="productName" /> -->
      <el-table-column label="词类型" align="center" prop="wordType" />
      <el-table-column
        width="120"
        label="词ID/词包ID"
        align="center"
        prop="wordId"
      />
      <el-table-column label="词名字/词包名字" align="center" prop="wordName" />
      <el-table-column label="展现量" align="center" prop="impressions" />
      <el-table-column label="点击量" align="center" prop="clicks" />
      <el-table-column label="花费" align="center" prop="cost" />
      <el-table-column label="点击率" align="center" prop="clickRate" />
      <el-table-column
        label="平均点击花费"
        align="center"
        prop="avgClickCost"
      />
      <el-table-column label="千次展现花费" align="center" prop="qps" />
      <el-table-column
        label="总预售成交金额"
        align="center"
        prop="totalPresellFinishAmount"
      />
      <el-table-column
        label="总预售成交笔数"
        align="center"
        prop="totalPresellFinishNumber"
      />
      <el-table-column
        label="直接预售成交金额"
        align="center"
        prop="directPresellFinishAmount"
      />
      <el-table-column
        label="直接预售成交笔数"
        align="center"
        prop="directPresellFinishNumber"
      />
      <el-table-column
        label="间接预售成交金额"
        align="center"
        prop="indirectPresellFinishAmount"
      />
      <el-table-column
        label="间接预售成交笔数"
        align="center"
        prop="indirectPresellFinishNumber"
      />
      <el-table-column
        label="直接成交金额"
        align="center"
        prop="directFinishAmount"
      />
      <el-table-column
        label="间接成交金额"
        align="center"
        prop="indirectFinishAmount"
      />
      <el-table-column
        label="总成交金额"
        align="center"
        prop="totalFinishAmount"
      />
      <el-table-column
        label="总成交笔数"
        align="center"
        prop="totalFinishNumber"
      />
      <el-table-column
        label="直接成交笔数"
        align="center"
        prop="directFinishNumber"
      />
      <el-table-column
        label="间接成交笔数"
        align="center"
        prop="indirectFinishNumber"
      />
      <el-table-column
        label="点击转化率"
        align="center"
        prop="clickConversionRate"
      />
      <el-table-column label="投入产出比" align="center" prop="roi" />
      <el-table-column label="总成交成本" align="center" prop="totalCost" />
      <el-table-column label="总购物车数" align="center" prop="totalCarts" />
      <el-table-column label="直接购物车数" align="center" prop="directCarts" />
      <el-table-column
        label="间接购物车数"
        align="center"
        prop="indirectCarts"
      />
      <el-table-column label="加购率" align="center" prop="addToCartRate" />
      <el-table-column
        label="收藏宝贝数"
        align="center"
        prop="collectProductCount"
      />
      <el-table-column
        label="收藏店铺数"
        align="center"
        prop="collectStoreCount"
      />
      <el-table-column
        label="店铺收藏成本"
        align="center"
        prop="storeCollectCost"
      />
      <el-table-column
        label="总收藏加购数"
        align="center"
        prop="totalCollectBuy"
      />
      <el-table-column
        label="总收藏加购成本"
        align="center"
        prop="totalCollectBuyCost"
      />
      <el-table-column
        label="宝贝收藏加购数"
        align="center"
        prop="collectBuyProduct"
      />
      <el-table-column
        label="宝贝收藏加购成本"
        align="center"
        prop="collectBuyProductCost"
      />
      <el-table-column label="总收藏数" align="center" prop="totalCollect" />
      <el-table-column
        label="宝贝收藏成本"
        align="center"
        prop="collectProductCost"
      />
      <el-table-column label="宝贝收藏率" align="center" prop="collectRate" />
      <el-table-column label="加购成本" align="center" prop="addToCartCost" />
      <el-table-column
        label="拍下订单笔数"
        align="center"
        prop="orderPlacementCount"
      />
      <el-table-column
        label="拍下订单金额"
        align="center"
        prop="orderPlacementAmount"
      />
      <el-table-column
        label="直接收藏宝贝数"
        align="center"
        prop="directCollectProduct"
      />
      <el-table-column
        label="间接收藏宝贝数"
        align="center"
        prop="indirectCollectProduct"
      />
      <el-table-column
        label="优惠券领取量"
        align="center"
        prop="couponGetNumber"
      />
      <el-table-column
        label="购物金充值笔数"
        align="center"
        prop="gwjRechargeCount"
      />
      <el-table-column
        label="购物金充值金额"
        align="center"
        prop="gwjRechargeAmount"
      />
      <el-table-column
        label="旺旺咨询量"
        align="center"
        prop="wwConsultationCount"
      />
      <el-table-column
        label="引导访问量"
        align="center"
        prop="guidedVisitNumber"
      />
      <el-table-column
        label="引导访问人数"
        align="center"
        prop="guidedVisitPeo"
      />
      <el-table-column
        label="引导访问潜客数"
        align="center"
        prop="guidedPotentialVisit"
      />
      <el-table-column
        label="引导访问潜客占比"
        align="center"
        prop="guidedPotentialVisitsRatio"
      />
      <el-table-column
        label="引导访问率"
        align="center"
        prop="guidedVisitsRate"
      />
      <el-table-column label="深度访问量" align="center" prop="depthOfVisit" />
      <el-table-column
        label="平均访问页面数"
        align="center"
        prop="avgPageViews"
      />
      <el-table-column
        label="成交新客数"
        align="center"
        prop="conversionRateNewCustomers"
      />
      <el-table-column
        label="成交新客占比"
        align="center"
        prop="conversionRateNewCustomersRatio"
      />
      <el-table-column
        label="会员首购人数"
        align="center"
        prop="vipFirstBuyPeo"
      />
      <el-table-column
        label="会员成交金额"
        align="center"
        prop="vipFinishAmount"
      />
      <el-table-column
        label="会员成交笔数"
        align="center"
        prop="vipFinishNumber"
      />
      <el-table-column label="成交人数" align="center" prop="vipFinishPeoNum" />
      <el-table-column
        label="人均成交笔数"
        align="center"
        prop="avgFinishNumber"
      />
      <el-table-column
        label="人均成交金额"
        align="center"
        prop="avgFinishAmount"
      />
      <el-table-column
        label="入会率"
        align="center"
        prop="membershipJoinRate"
      />
      <el-table-column
        label="入会量"
        align="center"
        prop="membershipJoinCount"
      />
      <el-table-column label="平均展现排名" align="center" prop="avgRanking" />
      <el-table-column label="月" align="center" prop="dataMonth" />
      <el-table-column label="年" align="center" prop="dataYear" />
      <el-table-column label="周" align="center" prop="dataWeek" />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['marketing:BiPromotionKeywordDwd:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['marketing:BiPromotionKeywordDwd:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改推广关键词数据日报对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="日期" prop="dataDate">
          <el-date-picker
            clearable
            v-model="form.dataDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="店铺id" prop="shopId">
          <el-input v-model="form.shopId" placeholder="请输入店铺id" />
        </el-form-item>
        <el-form-item label="渠道" prop="channel">
          <el-input v-model="form.channel" placeholder="请输入渠道" />
        </el-form-item>
        <el-form-item label="品牌" prop="brand">
          <el-input v-model="form.brand" placeholder="请输入品牌" />
        </el-form-item>
        <el-form-item label="场景ID" prop="sceneId">
          <el-input v-model="form.sceneId" placeholder="请输入场景ID" />
        </el-form-item>
        <el-form-item label="场景名字" prop="sceneName">
          <el-input v-model="form.sceneName" placeholder="请输入场景名字" />
        </el-form-item>
        <el-form-item label="计划ID" prop="planId">
          <el-input v-model="form.planId" placeholder="请输入计划ID" />
        </el-form-item>
        <el-form-item label="计划名字" prop="planName">
          <el-input v-model="form.planName" placeholder="请输入计划名字" />
        </el-form-item>
        <el-form-item label="单元ID" prop="unitId">
          <el-input v-model="form.unitId" placeholder="请输入单元ID" />
        </el-form-item>
        <el-form-item label="单元名字" prop="unitName">
          <el-input v-model="form.unitName" placeholder="请输入单元名字" />
        </el-form-item>
        <el-form-item label="宝贝ID" prop="productId">
          <el-input v-model="form.productId" placeholder="请输入宝贝ID" />
        </el-form-item>
        <el-form-item label="宝贝名字" prop="productName">
          <el-input v-model="form.productName" placeholder="请输入宝贝名字" />
        </el-form-item>
        <el-form-item label="词ID/词包ID" prop="wordId">
          <el-input v-model="form.wordId" placeholder="请输入词ID/词包ID" />
        </el-form-item>
        <el-form-item label="词名字/词包名字" prop="wordName">
          <el-input
            v-model="form.wordName"
            placeholder="请输入词名字/词包名字"
          />
        </el-form-item>
        <el-form-item label="展现量" prop="impressions">
          <el-input v-model="form.impressions" placeholder="请输入展现量" />
        </el-form-item>
        <el-form-item label="点击量" prop="clicks">
          <el-input v-model="form.clicks" placeholder="请输入点击量" />
        </el-form-item>
        <el-form-item label="花费" prop="cost">
          <el-input v-model="form.cost" placeholder="请输入花费" />
        </el-form-item>
        <el-form-item label="点击率" prop="clickRate">
          <el-input v-model="form.clickRate" placeholder="请输入点击率" />
        </el-form-item>
        <el-form-item label="平均点击花费" prop="avgClickCost">
          <el-input
            v-model="form.avgClickCost"
            placeholder="请输入平均点击花费"
          />
        </el-form-item>
        <el-form-item label="千次展现花费" prop="qps">
          <el-input v-model="form.qps" placeholder="请输入千次展现花费" />
        </el-form-item>
        <el-form-item label="总预售成交金额" prop="totalPresellFinishAmount">
          <el-input
            v-model="form.totalPresellFinishAmount"
            placeholder="请输入总预售成交金额"
          />
        </el-form-item>
        <el-form-item label="总预售成交笔数" prop="totalPresellFinishNumber">
          <el-input
            v-model="form.totalPresellFinishNumber"
            placeholder="请输入总预售成交笔数"
          />
        </el-form-item>
        <el-form-item label="直接预售成交金额" prop="directPresellFinishAmount">
          <el-input
            v-model="form.directPresellFinishAmount"
            placeholder="请输入直接预售成交金额"
          />
        </el-form-item>
        <el-form-item label="直接预售成交笔数" prop="directPresellFinishNumber">
          <el-input
            v-model="form.directPresellFinishNumber"
            placeholder="请输入直接预售成交笔数"
          />
        </el-form-item>
        <el-form-item
          label="间接预售成交金额"
          prop="indirectPresellFinishAmount"
        >
          <el-input
            v-model="form.indirectPresellFinishAmount"
            placeholder="请输入间接预售成交金额"
          />
        </el-form-item>
        <el-form-item
          label="间接预售成交笔数"
          prop="indirectPresellFinishNumber"
        >
          <el-input
            v-model="form.indirectPresellFinishNumber"
            placeholder="请输入间接预售成交笔数"
          />
        </el-form-item>
        <el-form-item label="直接成交金额" prop="directFinishAmount">
          <el-input
            v-model="form.directFinishAmount"
            placeholder="请输入直接成交金额"
          />
        </el-form-item>
        <el-form-item label="间接成交金额" prop="indirectFinishAmount">
          <el-input
            v-model="form.indirectFinishAmount"
            placeholder="请输入间接成交金额"
          />
        </el-form-item>
        <el-form-item label="总成交金额" prop="totalFinishAmount">
          <el-input
            v-model="form.totalFinishAmount"
            placeholder="请输入总成交金额"
          />
        </el-form-item>
        <el-form-item label="总成交笔数" prop="totalFinishNumber">
          <el-input
            v-model="form.totalFinishNumber"
            placeholder="请输入总成交笔数"
          />
        </el-form-item>
        <el-form-item label="直接成交笔数" prop="directFinishNumber">
          <el-input
            v-model="form.directFinishNumber"
            placeholder="请输入直接成交笔数"
          />
        </el-form-item>
        <el-form-item label="间接成交笔数" prop="indirectFinishNumber">
          <el-input
            v-model="form.indirectFinishNumber"
            placeholder="请输入间接成交笔数"
          />
        </el-form-item>
        <el-form-item label="点击转化率" prop="clickConversionRate">
          <el-input
            v-model="form.clickConversionRate"
            placeholder="请输入点击转化率"
          />
        </el-form-item>
        <el-form-item label="投入产出比" prop="roi">
          <el-input v-model="form.roi" placeholder="请输入投入产出比" />
        </el-form-item>
        <el-form-item label="总成交成本" prop="totalCost">
          <el-input v-model="form.totalCost" placeholder="请输入总成交成本" />
        </el-form-item>
        <el-form-item label="总购物车数" prop="totalCarts">
          <el-input v-model="form.totalCarts" placeholder="请输入总购物车数" />
        </el-form-item>
        <el-form-item label="直接购物车数" prop="directCarts">
          <el-input
            v-model="form.directCarts"
            placeholder="请输入直接购物车数"
          />
        </el-form-item>
        <el-form-item label="间接购物车数" prop="indirectCarts">
          <el-input
            v-model="form.indirectCarts"
            placeholder="请输入间接购物车数"
          />
        </el-form-item>
        <el-form-item label="加购率" prop="addToCartRate">
          <el-input v-model="form.addToCartRate" placeholder="请输入加购率" />
        </el-form-item>
        <el-form-item label="收藏宝贝数" prop="collectProductCount">
          <el-input
            v-model="form.collectProductCount"
            placeholder="请输入收藏宝贝数"
          />
        </el-form-item>
        <el-form-item label="收藏店铺数" prop="collectStoreCount">
          <el-input
            v-model="form.collectStoreCount"
            placeholder="请输入收藏店铺数"
          />
        </el-form-item>
        <el-form-item label="店铺收藏成本" prop="storeCollectCost">
          <el-input
            v-model="form.storeCollectCost"
            placeholder="请输入店铺收藏成本"
          />
        </el-form-item>
        <el-form-item label="总收藏加购数" prop="totalCollectBuy">
          <el-input
            v-model="form.totalCollectBuy"
            placeholder="请输入总收藏加购数"
          />
        </el-form-item>
        <el-form-item label="总收藏加购成本" prop="totalCollectBuyCost">
          <el-input
            v-model="form.totalCollectBuyCost"
            placeholder="请输入总收藏加购成本"
          />
        </el-form-item>
        <el-form-item label="宝贝收藏加购数" prop="collectBuyProduct">
          <el-input
            v-model="form.collectBuyProduct"
            placeholder="请输入宝贝收藏加购数"
          />
        </el-form-item>
        <el-form-item label="宝贝收藏加购成本" prop="collectBuyProductCost">
          <el-input
            v-model="form.collectBuyProductCost"
            placeholder="请输入宝贝收藏加购成本"
          />
        </el-form-item>
        <el-form-item label="总收藏数" prop="totalCollect">
          <el-input v-model="form.totalCollect" placeholder="请输入总收藏数" />
        </el-form-item>
        <el-form-item label="宝贝收藏成本" prop="collectProductCost">
          <el-input
            v-model="form.collectProductCost"
            placeholder="请输入宝贝收藏成本"
          />
        </el-form-item>
        <el-form-item label="宝贝收藏率" prop="collectRate">
          <el-input v-model="form.collectRate" placeholder="请输入宝贝收藏率" />
        </el-form-item>
        <el-form-item label="加购成本" prop="addToCartCost">
          <el-input v-model="form.addToCartCost" placeholder="请输入加购成本" />
        </el-form-item>
        <el-form-item label="拍下订单笔数" prop="orderPlacementCount">
          <el-input
            v-model="form.orderPlacementCount"
            placeholder="请输入拍下订单笔数"
          />
        </el-form-item>
        <el-form-item label="拍下订单金额" prop="orderPlacementAmount">
          <el-input
            v-model="form.orderPlacementAmount"
            placeholder="请输入拍下订单金额"
          />
        </el-form-item>
        <el-form-item label="直接收藏宝贝数" prop="directCollectProduct">
          <el-input
            v-model="form.directCollectProduct"
            placeholder="请输入直接收藏宝贝数"
          />
        </el-form-item>
        <el-form-item label="间接收藏宝贝数" prop="indirectCollectProduct">
          <el-input
            v-model="form.indirectCollectProduct"
            placeholder="请输入间接收藏宝贝数"
          />
        </el-form-item>
        <el-form-item label="优惠券领取量" prop="couponGetNumber">
          <el-input
            v-model="form.couponGetNumber"
            placeholder="请输入优惠券领取量"
          />
        </el-form-item>
        <el-form-item label="购物金充值笔数" prop="gwjRechargeCount">
          <el-input
            v-model="form.gwjRechargeCount"
            placeholder="请输入购物金充值笔数"
          />
        </el-form-item>
        <el-form-item label="购物金充值金额" prop="gwjRechargeAmount">
          <el-input
            v-model="form.gwjRechargeAmount"
            placeholder="请输入购物金充值金额"
          />
        </el-form-item>
        <el-form-item label="旺旺咨询量" prop="wwConsultationCount">
          <el-input
            v-model="form.wwConsultationCount"
            placeholder="请输入旺旺咨询量"
          />
        </el-form-item>
        <el-form-item label="引导访问量" prop="guidedVisitNumber">
          <el-input
            v-model="form.guidedVisitNumber"
            placeholder="请输入引导访问量"
          />
        </el-form-item>
        <el-form-item label="引导访问人数" prop="guidedVisitPeo">
          <el-input
            v-model="form.guidedVisitPeo"
            placeholder="请输入引导访问人数"
          />
        </el-form-item>
        <el-form-item label="引导访问潜客数" prop="guidedPotentialVisit">
          <el-input
            v-model="form.guidedPotentialVisit"
            placeholder="请输入引导访问潜客数"
          />
        </el-form-item>
        <el-form-item
          label="引导访问潜客占比"
          prop="guidedPotentialVisitsRatio"
        >
          <el-input
            v-model="form.guidedPotentialVisitsRatio"
            placeholder="请输入引导访问潜客占比"
          />
        </el-form-item>
        <el-form-item label="引导访问率" prop="guidedVisitsRate">
          <el-input
            v-model="form.guidedVisitsRate"
            placeholder="请输入引导访问率"
          />
        </el-form-item>
        <el-form-item label="深度访问量" prop="depthOfVisit">
          <el-input
            v-model="form.depthOfVisit"
            placeholder="请输入深度访问量"
          />
        </el-form-item>
        <el-form-item label="平均访问页面数" prop="avgPageViews">
          <el-input
            v-model="form.avgPageViews"
            placeholder="请输入平均访问页面数"
          />
        </el-form-item>
        <el-form-item label="成交新客数" prop="conversionRateNewCustomers">
          <el-input
            v-model="form.conversionRateNewCustomers"
            placeholder="请输入成交新客数"
          />
        </el-form-item>
        <el-form-item
          label="成交新客占比"
          prop="conversionRateNewCustomersRatio"
        >
          <el-input
            v-model="form.conversionRateNewCustomersRatio"
            placeholder="请输入成交新客占比"
          />
        </el-form-item>
        <el-form-item label="会员首购人数" prop="vipFirstBuyPeo">
          <el-input
            v-model="form.vipFirstBuyPeo"
            placeholder="请输入会员首购人数"
          />
        </el-form-item>
        <el-form-item label="会员成交金额" prop="vipFinishAmount">
          <el-input
            v-model="form.vipFinishAmount"
            placeholder="请输入会员成交金额"
          />
        </el-form-item>
        <el-form-item label="会员成交笔数" prop="vipFinishNumber">
          <el-input
            v-model="form.vipFinishNumber"
            placeholder="请输入会员成交笔数"
          />
        </el-form-item>
        <el-form-item label="成交人数" prop="vipFinishPeoNum">
          <el-input
            v-model="form.vipFinishPeoNum"
            placeholder="请输入成交人数"
          />
        </el-form-item>
        <el-form-item label="人均成交笔数" prop="avgFinishNumber">
          <el-input
            v-model="form.avgFinishNumber"
            placeholder="请输入人均成交笔数"
          />
        </el-form-item>
        <el-form-item label="人均成交金额" prop="avgFinishAmount">
          <el-input
            v-model="form.avgFinishAmount"
            placeholder="请输入人均成交金额"
          />
        </el-form-item>
        <el-form-item label="入会率" prop="membershipJoinRate">
          <el-input
            v-model="form.membershipJoinRate"
            placeholder="请输入入会率"
          />
        </el-form-item>
        <el-form-item label="入会量" prop="membershipJoinCount">
          <el-input
            v-model="form.membershipJoinCount"
            placeholder="请输入入会量"
          />
        </el-form-item>
        <el-form-item label="平均展现排名" prop="avgRanking">
          <el-input
            v-model="form.avgRanking"
            placeholder="请输入平均展现排名"
          />
        </el-form-item>
        <el-form-item label="月" prop="dataMonth">
          <el-input v-model="form.dataMonth" placeholder="请输入月" />
        </el-form-item>
        <el-form-item label="年" prop="dataYear">
          <el-input v-model="form.dataYear" placeholder="请输入年" />
        </el-form-item>
        <el-form-item label="周" prop="dataWeek">
          <el-input v-model="form.dataWeek" placeholder="请输入周" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog
      title="导入"
      :visible.sync="dialogVisible"
      width="500px"
      append-to-body
      v-if="dialogVisible"
    >
      <!-- 文件上传-->
      <el-form
        :rules="rules"
        :model="dataForm"
        ref="dataForm"
        label-width="150px"
        @submit.native.prevent
      >
        <el-form-item label="店铺：" prop="name">
          <!-- <el-input
            type="text"
            v-model.trim="dataForm.name"
            clearable
          ></el-input> -->
          <el-cascader
            class="region"
            v-model="dataForm.name"
            placeholder="选择店铺分组"
            :options="cascadeList"
            :props="{ checkStrictly: true }"
            style="width: 300px; height: 30px"
          >
          </el-cascader>
        </el-form-item>
        <el-form-item label="文件：" prop="file">
          <el-upload
            class="upload-import"
            ref="uploadImport"
            :http-request="httpRequest"
            action=""
            :on-remove="handleRemove"
            :file-list="fileList"
            :limit="1"
            :on-change="handleChange"
            :auto-upload="false"
            :before-upload="beforeAvatarUpload"
          >
            <!--
            accept="application/zip,.zip" 设置接收的文件类型-->
            <el-button
              v-show="!hasFile"
              slot="trigger"
              size="small"
              type="primary"
              >选取文件</el-button
            >
            <!-- <div slot="tip" class="el-upload__tip">
          只能上传zip文件，且不超过10M
        </div> -->
          </el-upload>
          <!-- 关闭自动上传-->
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitUpload">提交</el-button>
          <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
          <el-button @click="dialogVisible = false">取 消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import {
  listBiPromotionKeywordDwd,
  getBiPromotionKeywordDwd,
  delBiPromotionKeywordDwd,
  addBiPromotionKeywordDwd,
  updateBiPromotionKeywordDwd,
} from "@/api/marketing/BiPromotionKeywordDwd";
import { listAll, importBiKeyword } from "@/api/chart/brandChannelShop";
import timeSearch from "@/views/chart/day/day.vue";
import axios from "axios";
//--------导入token
import { getToken } from "@/utils/auth";
export default {
  name: "BiPromotionKeywordDwd",
  data() {
    return {
      cascadeList: [],
      dataForm: {
        name: ["VFU", "天猫", "vfu运动旗舰店"],
        file: null,
      },
      rules: {
        name: [
          { required: true, message: "请输入名称", trigger: "blur" },
          { max: 50, message: "最长可输入50个字符", trigger: "blur" },
          // { validator: isvalidatName, trigger: "blur" },
        ],
        file: [{ required: true, message: "请选择上传文件", trigger: "blur" }],
      },
      hasFile: false,
      fileList: [],
      dialogVisible: false,
      pjtUrl: process.env.VUE_APP_BASE_API,
      dayActive: 2,
      timeArr: [
        { value: "2", label: "昨天" },
        { value: "7", label: "最近7天" },
        { value: "30", label: "最近30天" },
        { value: "365", label: "最近一年" },
        { value: "1", label: "日" },
      ],
      timeGap: { startTime: "", endTime: "" },
      isOpen: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 推广关键词数据日报表格数据
      BiPromotionKeywordDwdList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        dataDate: null,
        shopId: null,
        channel: null,
        brand: null,
        sceneId: null,
        sceneName: null,
        planId: null,
        planName: null,
        unitId: null,
        unitName: null,
        productId: null,
        productName: null,
        wordType: null,
        wordId: null,
        wordName: null,
        impressions: null,
        clicks: null,
        cost: null,
        clickRate: null,
        avgClickCost: null,
        qps: null,
        totalPresellFinishAmount: null,
        totalPresellFinishNumber: null,
        directPresellFinishAmount: null,
        directPresellFinishNumber: null,
        indirectPresellFinishAmount: null,
        indirectPresellFinishNumber: null,
        directFinishAmount: null,
        indirectFinishAmount: null,
        totalFinishAmount: null,
        totalFinishNumber: null,
        directFinishNumber: null,
        indirectFinishNumber: null,
        clickConversionRate: null,
        roi: null,
        totalCost: null,
        totalCarts: null,
        directCarts: null,
        indirectCarts: null,
        addToCartRate: null,
        collectProductCount: null,
        collectStoreCount: null,
        storeCollectCost: null,
        totalCollectBuy: null,
        totalCollectBuyCost: null,
        collectBuyProduct: null,
        collectBuyProductCost: null,
        totalCollect: null,
        collectProductCost: null,
        collectRate: null,
        addToCartCost: null,
        orderPlacementCount: null,
        orderPlacementAmount: null,
        directCollectProduct: null,
        indirectCollectProduct: null,
        couponGetNumber: null,
        gwjRechargeCount: null,
        gwjRechargeAmount: null,
        wwConsultationCount: null,
        guidedVisitNumber: null,
        guidedVisitPeo: null,
        guidedPotentialVisit: null,
        guidedPotentialVisitsRatio: null,
        guidedVisitsRate: null,
        depthOfVisit: null,
        avgPageViews: null,
        conversionRateNewCustomers: null,
        conversionRateNewCustomersRatio: null,
        vipFirstBuyPeo: null,
        vipFinishAmount: null,
        vipFinishNumber: null,
        vipFinishPeoNum: null,
        avgFinishNumber: null,
        avgFinishAmount: null,
        membershipJoinRate: null,
        membershipJoinCount: null,
        avgRanking: null,
        dataMonth: null,
        dataYear: null,
        dataWeek: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
    this.getdataSourceList();
  },
  methods: {
    //图片上传前的相关判断
    beforeAvatarUpload(file) {
      // const isJPG = file.type == 'image/jpeg' || file.type == 'image/png';
      const isLt2M = file.size / 1024 / 1024 < 150;
      // if (!isJPG) {
      //     this.$message.error('上传头像图片只能是 JPG/PNG 格式!');
      // }
      if (!isLt2M) {
        this.$message.error("上传导入文件大小不能超过 150MB!");
      }

      return isLt2M;
    },
    handleRemove(file, fileList) {
      if (!fileList.length) {
        this.hasFile = false;
      }
      this.dataForm.file = null;
    },
    handleChange(file, fileList) {
      if (fileList.length >= 2) {
        return;
      }
      if (fileList.length === 1) {
        this.hasFile = true;
      }
      this.dataForm.file = file;
    },
    //确定按钮
    //调用组件upload的submit方法，从而触发httpRequest方法，实现手动上传
    submitUpload() {
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          this.$refs.uploadImport.submit();
        }
      });
    },
    httpRequest(param) {
      if (this.dataForm.name.length < 3) {
        this.$modal.msgWarning("请选择到店铺");
        return;
      }
      let fd = new FormData();
      fd.append("file", param.file); // 传文件
      fd.append("salesGrade", this.dataForm.name);
      //dataPar.file.raw
      console.log(JSON.stringify(fd));
      this.openLoading();
      axios
        .post(
          process.env.VUE_APP_BASE_API +
            "/marketing/BiPromotionKeywordDwd/importData",
          fd,
          {
            headers: {
              header: { responseType: "blob" },

              Authorization: "Bearer " + getToken(),
              "Content-Type": "multipart/form-data",
            }, //定义内容格式,很重要
            // timeout: 20000,
          }
        )
        .then((response) => {
          console.log(response);
          if (response.data.code == 200) {
            this.dialogVisible = false;

            this.$modal.closeLoading();
            this.$modal.msgSuccess("导入成功");
            this.hasFile = false;
            this.getList();
          }
        });
    },
    //部门文件导入修改打开
    daoru() {
      this.dialogVisible = true;
    },
    // 打开加载层
    openLoading() {
      this.$modal.loading("正在导入，请稍候！");
    },
    /** 查询品牌渠道店铺关系列表 */
    getdataSourceList() {
      listAll().then((response) => {
        let result = this.transformData(response);
        this.cascadeList = result;
      });
    },
    //店铺渠道品牌转换

    transformData(data) {
      let result = [];

      data.forEach((item) => {
        let brand = item.brand;
        let channel = item.channel;
        let shopName = item.shopName;

        // 如果brand在结果数组中不存在，则创建一个新的数组
        let brandIndex = result.findIndex(
          (brandObj) => brandObj.label === brand
        );
        if (brandIndex === -1) {
          result.push({
            label: brand,
            value: brand,
            children: [],
          });
          brandIndex = result.length - 1;
        }

        // 如果channel在当前brand的children数组中不存在，则创建一个新的数组
        let channelIndex = result[brandIndex].children.findIndex(
          (channelObj) => channelObj.label === channel
        );
        if (channelIndex === -1) {
          result[brandIndex].children.push({
            label: channel,
            value: channel,
            children: [],
          });
          channelIndex = result[brandIndex].children.length - 1;
        }

        // 如果shopName在当前channel的children数组中不存在，则创建一个新的数组
        let shopIndex = result[brandIndex].children[
          channelIndex
        ].children.findIndex((shopObj) => shopObj.label === shopName);
        if (shopIndex === -1) {
          result[brandIndex].children[channelIndex].children.push({
            label: shopName,
            value: shopName,
            // children: []
          });
        }
      });

      return result;
    },
    handleRefreshCache() {
      this.$modal.msgWarning("数据正在同步，请稍候");
      const obj = {
        startDate: this.timeGap.startTime,
        endDate: this.timeGap.endTime,
      };
      insertBatchFirstData(obj).then(() => {
        this.$modal.msgSuccess("同步数据成功");
        this.getList();
        // this.$store.dispatch('dict/cleanDict');
      });
    },
    handleLable() {
      this.$modal.msgWarning("数据正在同步，请稍候");
      const obj = {
        startDate: this.timeGap.startTime,
        endDate: this.timeGap.endTime,
      };
      updateKeywordLabel(obj).then(() => {
        this.$modal.msgSuccess("同步数据成功");
        this.getList();
        // this.$store.dispatch('dict/cleanDict');
      });
    },
    //时间控件
    changDay(val) {
      this.dayActive = val;
      this.timeGap.startTime = val[0];
      this.timeGap.endTime = val[1];
    },
    getDateArr(value) {
      this.timeGap.startTime = value[0];
      this.timeGap.endTime = value[1];
      console.log(JSON.stringify(this.timeGap));
      // this.queryParams.payDayStart = this.timeGap.startTime;
      // this.queryParams.payDayEnd = this.timeGap.endTime;

      // this.getList();

      this.dayActive = 1;
    },
    //部门文件导入修改打开
    daoru() {
      this.dialogVisible = true;
    },
    //点击某一行
    t(row, column, cell, event) {
      console.log(row, column, cell, event);
      this.handleUpdate(row);
    },
    //搜索栏展示与收起
    shouqi() {
      // console.log(1);
      this.isOpen = !this.isOpen;
    },
    /** 查询推广关键词数据日报列表 */
    getList() {
      this.loading = true;
      listBiPromotionKeywordDwd(this.queryParams).then((response) => {
        this.BiPromotionKeywordDwdList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        dataDate: null,
        shopId: null,
        channel: null,
        brand: null,
        sceneId: null,
        sceneName: null,
        planId: null,
        planName: null,
        unitId: null,
        unitName: null,
        productId: null,
        productName: null,
        wordType: null,
        wordId: null,
        wordName: null,
        impressions: null,
        clicks: null,
        cost: null,
        clickRate: null,
        avgClickCost: null,
        qps: null,
        totalPresellFinishAmount: null,
        totalPresellFinishNumber: null,
        directPresellFinishAmount: null,
        directPresellFinishNumber: null,
        indirectPresellFinishAmount: null,
        indirectPresellFinishNumber: null,
        directFinishAmount: null,
        indirectFinishAmount: null,
        totalFinishAmount: null,
        totalFinishNumber: null,
        directFinishNumber: null,
        indirectFinishNumber: null,
        clickConversionRate: null,
        roi: null,
        totalCost: null,
        totalCarts: null,
        directCarts: null,
        indirectCarts: null,
        addToCartRate: null,
        collectProductCount: null,
        collectStoreCount: null,
        storeCollectCost: null,
        totalCollectBuy: null,
        totalCollectBuyCost: null,
        collectBuyProduct: null,
        collectBuyProductCost: null,
        totalCollect: null,
        collectProductCost: null,
        collectRate: null,
        addToCartCost: null,
        orderPlacementCount: null,
        orderPlacementAmount: null,
        directCollectProduct: null,
        indirectCollectProduct: null,
        couponGetNumber: null,
        gwjRechargeCount: null,
        gwjRechargeAmount: null,
        wwConsultationCount: null,
        guidedVisitNumber: null,
        guidedVisitPeo: null,
        guidedPotentialVisit: null,
        guidedPotentialVisitsRatio: null,
        guidedVisitsRate: null,
        depthOfVisit: null,
        avgPageViews: null,
        conversionRateNewCustomers: null,
        conversionRateNewCustomersRatio: null,
        vipFirstBuyPeo: null,
        vipFinishAmount: null,
        vipFinishNumber: null,
        vipFinishPeoNum: null,
        avgFinishNumber: null,
        avgFinishAmount: null,
        membershipJoinRate: null,
        membershipJoinCount: null,
        avgRanking: null,
        dataMonth: null,
        dataYear: null,
        dataWeek: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加推广关键词数据日报";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getBiPromotionKeywordDwd(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改推广关键词数据日报";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateBiPromotionKeywordDwd(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addBiPromotionKeywordDwd(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除推广关键词数据日报编号为"' + ids + '"的数据项？')
        .then(function () {
          return delBiPromotionKeywordDwd(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "marketing/BiPromotionKeywordDwd/export",
        {
          ...this.queryParams,
        },
        `BiPromotionKeywordDwd_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
<style lang="scss" scoped>
span.textname {
  display: -webkit-box;

  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
}

.el-input.is-disabled ::v-deep .el-input__inner {
  color: #606266;
  background-color: white;
  border: none;
}

.el-textarea.is-disabled ::v-deep .el-textarea__inner {
  color: #606266;
  background-color: white;
  border: none;
  width: 500px;
  resize: none;
  cursor: pointer;
}
</style>